package com.huangyuan3h.StoreMarket.Rest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.huangyuan3h.StoreMarket.sinaAPI.HK;
import com.huangyuan3h.StoreMarket.sinaAPI.SH;
import com.huangyuan3h.StoreMarket.sinaAPI.SZ;
import com.huangyuan3h.StoreMarket.sinaAPI.SinaAPI;


@Controller
public class SinaRest {
	
	SinaAPI api=new SinaAPI();
			
	@RequestMapping(value = "/rest/stock/hk/{id}", method = RequestMethod.GET, produces = "application/json")
	public @ResponseBody HK GetHKStock(@PathVariable("id") String  id) {
		return api.getHKByCode(id);
	}
	
	@RequestMapping(value = "/rest/stock/sh/{id}", method = RequestMethod.GET, produces = "application/json")
	public @ResponseBody SH GetSHStock(@PathVariable("id") String  id) {
		return api.getSHByCode(id);
	}
	
	@RequestMapping(value = "/rest/stock/sz/{id}", method = RequestMethod.GET, produces = "application/json")
	public @ResponseBody SZ GetSZStock(@PathVariable("id") String  id) {
		return api.getSZByCode(id);
	}

}
